package com.jiazaibendi.lottery.common;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * description
 *
 * @author echo_kai
 * @version 1.0
 * @date 2021/08/08
 */
@ControllerAdvice
public class GlobalDefaultExceptionHandler {

    @ExceptionHandler({Exception.class})
    @ResponseBody
    public CommonResponse globalExceptionHandler(Exception e){
        e.printStackTrace();
        CommonResponse response = new CommonResponse(CommonResponseEnum.FAIL.getCode(), "系统异常", null);
        return response;
    }
}